package com.kuang.demo.config.wx;


import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.stereotype.Component;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;

@Component
public class SessionConfig extends DefaultWebSessionManager {

    @Override
    public Serializable getSessionId(ServletRequest request, ServletResponse response){
        HttpServletRequest req = (HttpServletRequest)request;
        String myHeader = req.getHeader("X-cskaoyan-mall-Admin-Token");
        if(myHeader != null && !"".equals(myHeader)){
            return myHeader;
        }

        return super.getSessionId(request,response);
    }
}
